#
# @lc app=leetcode.cn id=455 lang=python3
#
# [455] 分发饼干
#

# @lc code=start
class Solution:
    def findContentChildren(self, g: List[int], s: List[int]) -> int:
        g.sort()
        s.sort()
        greedIndex = 0
        sizeIndex = 0
        result = 0
        greedLength = len(g)
        sizeLength = len(s)
        while greedIndex < greedLength and sizeIndex < sizeLength:
            # 饼干满足条件
            if g[greedIndex] <= s[sizeIndex]:
                result += 1
                greedIndex += 1
                sizeIndex += 1
            else: 
                sizeIndex += 1
                
        return result
# @lc code=end

